home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16305 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: newsfeed.tip.net!dataphone!newsmaster
  2. From: skorpio@dataphone.se (Jarmo Paavilainen)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: goto command
  5. Date: 10 Apr 1996 09:27:45 GMT
  6. Organization: Dataphone Communication Networks
  7. Message-ID: <4kfuuh$3v8@nic.dataphone.se>
  8. References: <4k9vne$9lu@nntp.igs.net><4k9vne$9lu@nntp.igs.net> <9604081700.AA001p0@lorelei.demon.co.uk>
  9. Reply-To: skorpio@dataphone.se
  10. NNTP-Posting-Host: nikson.dataphone.se
  11. X-Newsreader: NeoLogic News for OS/2 [version: 4.5 YO Beta]
  12.  
  13. In message <9604081700.AA001p0@lorelei.demon.co.uk> - John Croudy
  14. ..
  15. :>Sounds like you need a while-loop or a for-loop... but not a goto!
  16. :>
  17. :>I like to pretend goto doesn't exist!
  18.  
  19. Why ?! goto is great for jumping out of loops !
  20.  
  21. ex.
  22.  
  23. REDO:
  24. for(i = 0;i<20;i++)
  25.  {
  26.  ...Do something
  27.  while(x != 3)
  28.   {
  29.   ...Do something
  30.   while(y ==4)
  31.    {
  32.    ...Do something
  33.  
  34.    if(t == 8)
  35.     goto DONE;
  36.  
  37.    if(t == 9)
  38.     goto REDO;
  39.  
  40.    ...Do something
  41.    }
  42.   ...Do something
  43.   }
  44.  ...Do something
  45.  }
  46.  
  47. DONE:
  48. .. We are done !
  49.  
  50. Take care,
  51. Skorpio
  52. _________________________________________________________________________
  53.  Jarmo Paavilainen, Skorpio                         skorpio@dataphone.se
  54.  
  55.